namespace ASPNET.UserControls
{
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class TextImage : UserControl
    {
        [AccessedThroughProperty("ctlImage")]
        private Image _ctlImage;
        [AccessedThroughProperty("lblText")]
        private Label _lblText;
        private object designerPlaceholderDeclaration;
        public string ImageDirectory;

        public TextImage()
        {
            base.Init += new EventHandler(this.Page_Init);
            base.PreRender += new EventHandler(this.Page_PreRender);
            this.ImageDirectory = string.Empty;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
        }

        private void Page_Init(object sender, EventArgs e)
        {
            this.InitializeComponent();
        }

        private void Page_PreRender(object sender, EventArgs e)
        {
            if (StringType.StrCmp(this.ImageUrl, string.Empty, false) != 0)
            {
                this.ctlImage.ImageUrl = "~/ACR/Images" + this.ImageDirectory + "/" + this.ImageUrl;
                this.ctlImage.ToolTip = this.Text;
            }
            else
            {
                this.ctlImage.Visible = false;
                this.lblText.Visible = true;
                this.lblText.Text = this.Text;
            }
        }

        protected virtual Image ctlImage
        {
            get
            {
                return this._ctlImage;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                if (this._ctlImage != null)
                {
                }
                this._ctlImage = value;
                if (this._ctlImage != null)
                {
                }
            }
        }

        public string ImageUrl
        {
            get
            {
                if (this.ViewState["ImageUrl"] == null)
                {
                    return string.Empty;
                }
                return StringType.FromObject(this.ViewState["ImageUrl"]);
            }
            set
            {
                this.ViewState["ImageUrl"] = value;
            }
        }

        protected virtual Label lblText
        {
            get
            {
                return this._lblText;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                if (this._lblText != null)
                {
                }
                this._lblText = value;
                if (this._lblText != null)
                {
                }
            }
        }

        public string Text
        {
            get
            {
                if (this.ViewState["Text"] == null)
                {
                    return string.Empty;
                }
                return StringType.FromObject(this.ViewState["Text"]);
            }
            set
            {
                this.ViewState["Text"] = value;
            }
        }
    }
}

